@extends('layouts.app')
@section('title','Topic')
@section('content')
<div class="container">
    <div class="row justify-content-center">
        <div class="col-sm-12 col-md-11 col-lg-10 col-xl-10">
            <div class="card">
                <div class="card-body">

                    <form method="post" action="{{route('topics.store')}}" enctype="multipart/form-data">

                        {{csrf_field()}}
                        <input name="user_id" value="{{Auth::id()}}" hidden>
                        <div class="form-group">
                            <label for="title">名称</label>
                            <input class="form-control" type="text" id="title" name="title" placeholder="请填写话题名称">
                        </div>

                        <div class="form-group">
                            <label for="body">内容</label>
                            <textarea class="form-control" type="text" id="body" name="body" placeholder="请填写话题内容"></textarea>
                        </div>

                        <div class="form-group">
                            <label for="order">排序</label>
                            <input class="form-control" type="number" id="order" name="order" value="0" placeholder="请填写话题Order(默认为0)">
                        </div>

                        <div class="form-group">
                            <label for="category">类别</label>
                            <select class="form-control custom-select"  id="category" name="category_id">
                                @foreach($categories as $category)
                                    <option value="{{$category->id}}">{{$category->name}}</option>
                                @endforeach
                            </select>
                        </div>
                        <div class="form-group">
                            <label for="image">封面图</label>
                            <input class="form-control" type="file" id="image" name="image">
                        </div>
                        <button class="btn btn-primary" type="submit">创建</button>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
@endsection
